// Penanggung jawab : Dimas Gilang Saputra / 13509038

public class tanaman {

	protected int ID;
		// Menunjukkan nomor ID tanaman
		// 1 = ganja, 2 = opium, 3 = coca, 4 = tobacco, 5 = anggur, 6 = mushroom
	protected int HappyMeter;
		// Menunjukkan happy meter tanaman
		// Happy meter awal adalah 0 dan bertambah jika tanaman telah disiram dan hari telah berganti
	protected int TitikDewasa;
		// Menunjukkan titik dewasa tanaman
		// Jika happy meter tanaman telah mencapai titik dewasanya maka tanaman sudah dewasa
	protected int TitikPanen;
		// Menunjukkan titik panen tanaman
		// Jika happy meter tanaman telah mencapai titik panennya maka tanaman sudah saatnya panen
	protected int Umur;
		// Menunjukkan umur tananam
		// Jika umur tanaman mencapai 0 maka tanaman sudah mati
	protected int TipePanen;
		// Menunjukkan tipe panen tanaman
		// Jika tipe panen = 0 maka panen dapat dilakukan berulang-ulang
		// Jika tipe panen = 1 maka tidak bisa dipanen berulang-ulang karena tanaman langsung hilang
	protected int HargaBibit;
		// Menunjukkan harga bibit tanaman
	protected int HargaPanen;
		// Menunjukkan harga hasil panen tanaman
	protected int EfekOverDosis;
		// Menunjukkan berapa banyak penambahan overdosis dalam overdosis meter
	protected int EfekSakaw;
		// Menunjukkan berapa banyak penambahan sakaw dalam sakaw meter
	protected int TipeTanaman;
		// Menunjukkan tipe tanaman
		// 0 = bibit, 1 = hasil panen, 9 = belum ditentukan

	protected static int[][] DaftarInfo = {
	// Harga bibit | Harga hasil panen | OD meter | Sakaw meter
		{ 5,			10,					10,			-20		}, // Ganja
		{ 10,			20,					15,			-17		}, // Opium
		{ 8,			15,					13,			-25		}, // Coca
		{ 3,			6,					-15,		-1		}, // Tobacco
		{ 3,			6,					-20,		-3		}, // Anggur
		{ 4,			8,					8,			-15		}  // Mushroom
		};

	// Konstruktor
	public tanaman() {
		ID = 9;
		HappyMeter = 0;
		TitikDewasa = 0;
		TitikPanen = 0;
		Umur = 0;
		TipePanen = 0;
		HargaBibit = 0;
		HargaPanen = 0;
		EfekOverDosis = 0;
		EfekSakaw = 0;
		TipeTanaman = 9;
	}
	
	// Show
	// void showHargaBibit(){
		// cout << "\nHarga bibit :" << endl;
		// cout << "Ganja    = " << getDaftarInfo(0,0) << " bucks" << endl;
		// cout << "Opium    = " << getDaftarInfo(1,0) << " bucks" << endl;
		// cout << "Coca     = " << getDaftarInfo(2,0) << " bucks" << endl;
		// cout << "Tobacco  = " << getDaftarInfo(3,0) << " bucks" << endl;
		// cout << "Anggur   = " << getDaftarInfo(4,0) << " bucks" << endl;
		// cout << "Mushroom = " << getDaftarInfo(5,0) << " bucks" << endl;
	// }
	// void showHargaPanen(){
		// cout << "\nHarga hasil panen :" << endl;
		// cout << "Ganja    = " << getDaftarInfo(0,1) << " bucks" << endl;
		// cout << "Opium    = " << getDaftarInfo(1,1) << " bucks" << endl;
		// cout << "Coca     = " << getDaftarInfo(2,1) << " bucks" << endl;
		// cout << "Tobacco  = " << getDaftarInfo(3,1) << " bucks" << endl;
		// cout << "Anggur   = " << getDaftarInfo(4,1) << " bucks" << endl;
		// cout << "Mushroom = " << getDaftarInfo(5,1) << " bucks" << endl;
	// }
		
	// Get
	// int getDaftarInfo(int a, int b)	{return DaftarInfo[a][b];}//[a][b];}
	public int getID()						{return ID;}
	public int getHappyMeter() 				{return HappyMeter;}
	public int getTitikDewasa() 				{return TitikDewasa;}
	public int getTitikPanen() 				{return TitikPanen;}
	public int getUmur() 						{return Umur;}
	public int getTipePanen() 				{return TipePanen;}
	public int getHargaBibit() 				{return HargaBibit;}
	public int getHargaPanen() 				{return HargaPanen;}
	public int getEfekOverDosis() 			{return EfekOverDosis;}
	public int getEfekSakaw() 				{return EfekSakaw;}
	public int getTipeTanaman()				{return TipeTanaman;}

	// Set
	public void setID(int a) 				{ID = a;}
	public void setHappyMeter(int a) 		{HappyMeter = a;}
	public void setTitikDewasa(int a) 	{TitikDewasa = a;}
	public void setTitikPanen(int a) 		{TitikPanen = a;}
	public void setUmur(int a) 			{Umur = a;}
	public void setTipePanen(int a) 		{TipePanen = a;}
	public void setHargaBibit(int a)		{HargaBibit = a;}
	public void setHargaPanen(int a) 		{HargaPanen = a;}
	public void setEfekOverDosis(int a)	{EfekOverDosis = a;}
	public void setEfekSakaw(int a) 		{EfekSakaw = a;}
	public void setTipeTanaman(int a)		{TipeTanaman = a;}
	public void setAll(int I, int HM, int TD, int TP, int U,
							int Tipan, int HB, int HP, int EOD, int ES, int WIT){
		ID	= I;
		HappyMeter = HM;
		TitikDewasa = TD;
		TitikPanen = TP;
		Umur = U;
		TipePanen = Tipan;
		HargaBibit = HB;
		HargaPanen = HP;
		EfekOverDosis = EOD;
		EfekSakaw = ES;
		TipeTanaman = WIT;
	}

	// Predikat
	public int isDewasa() {
		// Kamus
		int i,j;
		// Algoritma
		i = (HappyMeter*100)/TitikDewasa;
		if (i >= 100) {
			j = 1;
		}
		else {
			j = 0;
		}
		return j;
	}
	public int isPanen(){
		// Kamus
		int i,j;
		// Algoritma
		i = (HappyMeter*100)/TitikPanen;
		if (i >= 100) {
			j = 1;
		}
		else {
			j = 0;
		}
		return j;
	}
	public int isMati() {
		// Kamus
		int i;
		// Algoritma
		if (Umur <= 0) {
			i = 1;
		}
		else {
			i = 0;
		}
		return i;
	}

	// Method lain
	public void tambahHappyMeter(int param)	{ HappyMeter += param; }
	public void kurangiUmur(int param) 		{ Umur -= param; }

	// void showInformasi(){
		// if		(getID() == 1) { cout << "Ganja :" << endl; }
		// else if (getID() == 2) { cout << "Opium :" << endl; }
		// else if (getID() == 3) { cout << "Coca :" << endl; }
		// else if (getID() == 4) { cout << "Tobacco :" << endl; }
		// else if (getID() == 5) { cout << "Anggur :" << endl; }
		// else if (getID() == 6) { cout << "Mushroom :" << endl; }
		// else if (getID() == 9) { cout << "Undefined tanaman :" << endl; }
		// cout << "ID                = " << getID() << endl;
		// cout << "Happy meter       = " << getHappyMeter() << endl;
		// cout << "Titik dewasa      = " << getTitikDewasa() << endl;
		// cout << "Titik panen       = " << getTitikPanen() <<endl;
		// cout << "Umur              = " << getUmur() << endl;
		// cout << "Tipe Panen        = ";
			// if (getTipePanen() == 1) { cout << "Berulang *kayanya *lupa"; }
			// else if (getTipePanen() == 0) { cout << "Hilang *kayanya *lupa"; }
			// cout << endl;
		// //cout << "Posisi            = " << getPosisi() << endl;
		// cout << "Harga bibit       = " << getHargaBibit() << endl;
		// cout << "Harga hasil panen = " << getHargaPanen() << endl;
		// cout << "Efek over dosis   = " << getEfekOverDosis() << endl;
		// cout << "Efek sakaw        = " << getEfekSakaw() << endl;
		// cout << "What is this      = ";
			// if (getTipeTanaman() == 0) { cout << "Bibit *kayanya *lupa"; }
			// else if (getTipeTanaman() == 1) { cout << "Hasil panen *kayanya *lupa"; }
			// else if (getTipeTanaman() == 9) { cout << "Undefined"; }
			// cout << endl;
	// }
}